<?php

abstract class Api_Controller_Abstract extends Zend_Controller_Action
{
    protected $_em = null;

    public function init()
    {
        $this->_initEntityManager();
        $this->_initModuleActionHelper();
    }
    
    private function _initEntityManager()
    {
        $this->_em = Zend_Registry::get('doctrine')->getEntityManager();
    }
    
    private function _initModuleActionHelper()
    {
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $moduleName = $request->getModuleName();
        Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/' . $moduleName . '/actions/helpers', 
            ucfirst($moduleName) . '_Action_Helper_');
    }

}